// pages/home/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo:{
      leval: 0
    },
    selectNum: 0,
    tabs: [
      {text: '关注', path: 'follow'},
      {text: '推荐', path: 'recommend'},
      {text: '课程', path: 'courses'},
      {text: '计划', path: 'programs'},
      {text: '活动', path: 'events'},
    ]
  },
  changeTab(e) {
    const path = e.currentTarget.dataset.path;
    const index = this.data.tabs.findIndex(item => item.path === path);
    if (index !== -1) {
      this.setData({
        selectNum: index
      });
    }
  }
})